package io;

import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.WhileNode;

import java.io.*;
import java.util.Scanner;

/*
简易记事本工具
 */
public class NoteDemo {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        Scanner sn = new Scanner(System.in);
        System.out.println("请输入要写出的文件命");
        String name = sn.nextLine();
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(name, true), "UTF-8")),true);
        {
       /* FileOutputStream fin = new FileOutputStream(name);
        OutputStreamWriter ow = new OutputStreamWriter(fin, "UTF-8");
        BufferedWriter bw = new BufferedWriter(ow);
        PrintWriter pw = new PrintWriter(bw);*/
            System.out.println("写出数据");
            while (true) {
                String line = sn.nextLine();
                if ("exit".equals(line)) {
                    break;
                } else {
                    pw.println(line);
                }
            }
            pw.close();


        }
    }
    }









